import http from '@/utils/http'

// 加入购物车
export const insertCartAPI = ({ skuId, count, userId }) => {
    return http({
        url: '/member/cart',
        method: 'POST',
        data: {
            skuId,
            count
        },
        params: {
            userId
        }
    })
}

//获取最新的购物车列表
export const findNewCartListAPI = (userId) => {
    return http({
        url: '/member/cart',
        params: {
            userId
        }
    })
}

// 调试购物车数据
export const debugCartAPI = (userId) => {
    return http({
        url: '/member/cart/debug',
        params: {
            userId
        }
    })
}

// 删除购物车
export const delCartAPI = (ids, userId) => {
  return http({
    url: '/member/cart',
    method: 'DELETE',
    data: {
      ids
    },
    params: {
      userId
    }
  })
}

export const mergeCartAPI = (data, userId) => {
    return http({
        url: '/member/cart/merge',
        method: 'POST',
        data,
        params: {
            userId
        }
    })
}
